#include <bits/stdc++.h>

#define in read()
#define fi first
#define se second
#define pii pair<int,int>
#define pb push_back
#define vec vector<int>
#define y1 y_____hahahaha_____1

using namespace std;

typedef long long ll;
typedef double db;
typedef unsigned long long ull;
typedef long double ldb;

int read(){int x = 0,sgn = 1;char ch = getchar();for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;for(;isdigit(ch);ch = getchar()) x = (x << 1) + (x << 3) + (ch ^ 48); return x * sgn;}

const int mod = 998244353;
const int N = 5010;

ll qp(ll x,int t){ll res = 1;for(;t;t >>= 1,x = x * x % mod) if(t & 1) res = res * x % mod;return res;}

int n,m;
ll pw[N],inv[N],f[N][N],ans;

int main(){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,m = in; inv[1] = 1;
	for(int i = 2;i <= m;i++) inv[i] = inv[mod % i] * (mod - mod / i) % mod;
	f[0][0] = 1;
	for(int i = 1;i <= m;i++) f[i][0] = f[i-1][0] * (n - i + 1) % mod * inv[i] % mod;
	for(int i = 1;i <= m;i++) f[0][i] = f[0][i - 1] * 2 % mod;
	for(int i = 1;i <= m;i++)
		for(int j = 1;j <= m;j++){
			f[i][j] = (2 * f[i][j-1] + f[i-1][j-1] - f[i-1][j] + mod) % mod;
			ans ^= f[i][j];
		}
	printf("%lld\n",ans);
	return 0;
}
